package com.yan.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class RestFulController3 {


    @RequestMapping("/com/{a}/{b}")
    public String  index(@PathVariable int a,@PathVariable String b, Model model){

      String  as=a+b;
      model.addAttribute("msg","结果1的为"+as);

    return "text";
    }



    @RequestMapping(value = "/com1/{a}/{b}",method = RequestMethod.GET)
    public String  index1(@PathVariable int a,@PathVariable String b, Model model){

        String  as=a+b;
        model.addAttribute("msg","结果1的为"+as);

        return "text";
    }


    @GetMapping("/com2/{a}/{b}")
    public String  index2(@PathVariable int a,@PathVariable String b, Model model){

        String  as=a+b;
        model.addAttribute("msg","结果1的为"+as);

        return "text";
    }



}
